const mongoose = require('mongoose')

const contentSchema = new mongoose.Schema({
    author:{
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Normal',
        default:'61ebac6d0bb1ed1e78ca85c6'
    },
    content: {
        type: String,
        required: [true, '评论内容不能为空']
    },
    article: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Article'
    },
    time: {
        type: Date,
        default: new Date()
    },
    child: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Reply'
        }
    ],
    status:{
        type:Boolean,
        default:false
    }
})

// 3.根据规则创建集合
const Content = mongoose.model('Content', contentSchema);


// 4.将集合做为模块成员进行导出
module.exports = Content
